//
//  BannerDetailViewController.swift
//  Eternity
//
//  Created by cll12_12 on 2017/1/13.
//  Copyright © 2017年 ZhengWei. All rights reserved.
//

import UIKit

class BannerDetailViewController: BaseViewController {

    var link: String?

    // MARK: - life cycle
    override func viewDidLoad() {
        super.viewDidLoad()
        
        initBaseLayout()
        layoutPageSubviews()
        initNavItem(controller: self, imageName: "nav_back_n", highlitedImageName: "nav_back_h", selectedImageName: "", isLeft: true)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    // MARK: - private method
    func initBaseLayout() {
        self.view.addSubview(webView)
    }
    
    func layoutPageSubviews() {
        webView.snp.makeConstraints { (make) in
            make.edges.equalTo(self.view).inset(UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0))
        }
    }
    
    // MARK: - setters and getters
    var _webView: UIWebView!
    var webView: UIWebView {
        if _webView == nil {
            _webView = UIWebView()
            _webView.backgroundColor = UIColor.white
            _webView.scalesPageToFit = true
            _webView.loadRequest(URLRequest(url: URL(string: link!)!))
        }
        return _webView
    }
    

}
